library(dotwhisker)
library(tidyverse)

load("models.Rda")

dwplot(fitconst,
       by_2sd = F,
       dodge_size = 0.6,
       vline = geom_vline(xintercept = 0),
       dot_args = list(size = 1.75, color = "black", shape = 1),
       whisker_args = list(color = "black")) %>%
  relabel_predictors(c(east      = "East",
                       logdens   = "Log population\ndensity",
                       forn      = "Foreign-born\npopulation",
                       migrant   = "Migrant-origin\npopulation",
                       unemp     = "Unemployment",
                       loggdppc  = "Log GDP\nper capita",
                       avgage    = "Average age",
                       avged     = "Average\neducation",
                       minorleft = "Minor left\nvote share",
                       round     = "Voting round")) +
  xlab("Coefficient estimate") +
  theme_bw() +
  theme(plot.margin = margin(0, 0, 0, 0, "pt"),
        axis.title.y = element_blank())

ggsave("coefplot.tiff", scale = 1, width = 3.25, height = 3.25, units = "in", dpi = 2400)
